# From phc revision 907 onwards, name prefixes have been removed on classes.
# For example, "HIR::HIR_node" is now called "HIR::node" (namespaces were 
# introduced earlier). This script can be used to update 'legacy' code.
#
# Use 
#
#   perl -n -i- convert_HIR_names foo.cpp 
#
# To convert 'foo.cpp' (a backup 'foo.cpp-' will be created)
s/HIR_node(?!\.)/Node/g;
s/HIR_php_script(?!\.)/PHP_script/g;
s/HIR_statement(?!\.)/Statement/g;
s/HIR_class_mod(?!\.)/Class_mod/g;
s/HIR_member(?!\.)/Member/g;
s/HIR_signature(?!\.)/Signature/g;
s/HIR_method_mod(?!\.)/Method_mod/g;
s/HIR_formal_parameter(?!\.)/Formal_parameter/g;
s/HIR_type(?!\.)/Type/g;
s/HIR_attr_mod(?!\.)/Attr_mod/g;
s/HIR_name_with_default(?!\.)/Name_with_default/g;
s/HIR_catch(?!\.)/Catch/g;
s/HIR_variable_name(?!\.)/Variable_name/g;
s/HIR_target(?!\.)/Target/g;
s/HIR_array_elem(?!\.)/Array_elem/g;
s/HIR_method_name(?!\.)/Method_name/g;
s/HIR_actual_parameter(?!\.)/Actual_parameter/g;
s/HIR_class_name(?!\.)/Class_name/g;
s/HIR_identifier(?!\.)/Identifier/g;
s/HIR_class_def(?!\.)/Class_def/g;
s/HIR_interface_def(?!\.)/Interface_def/g;
s/HIR_method(?!\.)/Method/g;
s/HIR_attribute(?!\.)/Attribute/g;
s/HIR_return(?!\.)/Return/g;
s/HIR_static_declaration(?!\.)/Static_declaration/g;
s/HIR_global(?!\.)/Global/g;
s/HIR_try(?!\.)/Try/g;
s/HIR_throw(?!\.)/Throw/g;
s/HIR_eval_expr(?!\.)/Eval_expr/g;
s/HIR_branch(?!\.)/Branch/g;
s/HIR_goto(?!\.)/Goto/g;
s/HIR_label(?!\.)/Label/g;
s/HIR_foreach_reset(?!\.)/Foreach_reset/g;
s/HIR_foreach_next(?!\.)/Foreach_next/g;
s/HIR_foreach_end(?!\.)/Foreach_end/g;
s/HIR_expr(?!\.)/Expr/g;
s/HIR_reflection(?!\.)/Reflection/g;
s/Token_class_name(?!\.)/CLASS_NAME/g;
s/Token_interface_name(?!\.)/INTERFACE_NAME/g;
s/Token_method_name(?!\.)/METHOD_NAME/g;
s/Token_variable_name(?!\.)/VARIABLE_NAME/g;
s/Token_label_name(?!\.)/LABEL_NAME/g;
s/Token_ht_iterator(?!\.)/HT_ITERATOR/g;
s/Token_cast(?!\.)/CAST/g;
s/Token_op(?!\.)/OP/g;
s/Token_constant_name(?!\.)/CONSTANT_NAME/g;
s/HIR_foreach_has_key(?!\.)/Foreach_has_key/g;
s/HIR_foreach_get_key(?!\.)/Foreach_get_key/g;
s/HIR_foreach_get_data(?!\.)/Foreach_get_data/g;
s/HIR_literal(?!\.)/Literal/g;
s/HIR_assignment(?!\.)/Assignment/g;
s/HIR_cast(?!\.)/Cast/g;
s/HIR_unary_op(?!\.)/Unary_op/g;
s/HIR_bin_op(?!\.)/Bin_op/g;
s/HIR_constant(?!\.)/Constant/g;
s/HIR_instanceof(?!\.)/Instanceof/g;
s/HIR_variable(?!\.)/Variable/g;
s/HIR_pre_op(?!\.)/Pre_op/g;
s/HIR_array(?!\.)/Array/g;
s/HIR_method_invocation(?!\.)/Method_invocation/g;
s/HIR_new(?!\.)/New/g;
s/Token_int(?!\.)/INT/g;
s/Token_real(?!\.)/REAL/g;
s/Token_string(?!\.)/STRING/g;
s/Token_bool(?!\.)/BOOL/g;
s/Token_null(?!\.)/NIL/g;
s/HIR_transform(?!\.)/Transform/g;
s/HIR_visitor(?!\.)/Visitor/g;
s/HIR_fold(?!\.)/Fold/g;
s/HIR_factory(?!\.)/Node_factory/g;
print;
